<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script src="/html/axios.min.js"></script>

    <script>
        function $(id) {
        return document.getElementById(id);
        }

        function land() {
            axios.get("/user/login",{
                params:{
                    userName:$("userName").value,
                    pwd:$("pwd").value
                }
            }).then(resp =>{
                if (resp.data == "ok"){

                    location.href = "/html/index.html";
                }
                else {
                    $("errorDiv").innerHTML = "登录失败";
                }
            });

        }
    </script>
</head>
<body>

    <div id="errorDiv" style="color:red;"></div>
    用户名：<input type="text" id="userName"><br>
    密码：<input type="password" id="pwd"><br>
    <input type="button" value="登录" onclick="land()">

</body>
</html>